//package com.mall.order.biz.convert;/**
// * Created by ciggar on 2019/8/2.
// */
//
//import com.mall.commons.result.AbstractRequest;
//import com.mall.commons.result.AbstractResponse;
//import com.mall.order.biz.context.CreateOrderContext;
//import com.mall.order.biz.context.TransHandlerContext;
//import com.mall.order.constant.OrderRetCode;
//import com.mall.order.dto.CreateOrderRequest;
//import com.mall.order.dto.CreateOrderResponse;
//
///**
// *  ciggar
// * create-date: 2019/8/2-下午11:04
// */
//public class CreateOrderConvert implements TransConvert{
//
//
//    // 把我们的request转化为 context
//    @Override
//    public TransHandlerContext convertRequest2Ctx(AbstractRequest req, TransHandlerContext context) {
//        CreateOrderRequest createOrderRequest=(CreateOrderRequest)req;
//        CreateOrderContext createOrderContext=(CreateOrderContext) context;
//        createOrderContext.setAddressId(createOrderRequest.getAddressId());
//        createOrderContext.setCartProductDtoList(createOrderRequest.getCartProductDtoList());
//        createOrderContext.setOrderTotal(createOrderRequest.getOrderTotal());
//        createOrderContext.setStreetName(createOrderRequest.getStreetName());
//        createOrderContext.setTel(createOrderRequest.getTel());
//        createOrderContext.setUserId(createOrderRequest.getUserId());
//        createOrderContext.setUserName(createOrderRequest.getUserName());
//        createOrderContext.setUniqueKey(createOrderRequest.getUniqueKey());
//        return createOrderContext;
//    }
//
//    // 把我们经过管道模式处理的结果转化为response
//    @Override
//    public AbstractResponse convertCtx2Respond(TransHandlerContext ctx) {
//        CreateOrderContext createOrderContext=(CreateOrderContext) ctx;
//        CreateOrderResponse createOrderResponse=new CreateOrderResponse();
//        createOrderResponse.setOrderId(createOrderContext.getOrderId());
//        createOrderResponse.setCode(OrderRetCode.SUCCESS.getCode());
//        createOrderResponse.setMsg(OrderRetCode.SUCCESS.getMessage());
//        return createOrderResponse;
//    }
//}
